package xyz.labmem.lipx.core.protocol

/**
 * @description: do something
 * @author: ltty
 * @date: 2022/5/30 15:03
 */
enum class LabMessageType(c: Int) {

    REGISTER(1),//注册
    REGISTER_RESULT(2),//注册返回
    CONNECTED(3),//连接
    DISCONNECTED(4),//断开连接
    DATA(5),//数据
    KEEPALIVE(6);//心跳

    val code = c

    companion object {
        @Throws(Exception::class)
        fun valueOf(code: Int): LabMessageType {
            for (item in LabMessageType.values()) {
                if (item.code == code) {
                    return item
                }
            }
            throw Exception("LabMessageType code error: $code")
        }
    }


}